/*
 * @Author: zoujingshan 458726480@qq.com
 * @Date: 2025-02-12 13:31:14
 * @LastEditors: zoujingshan 458726480@qq.com
 * @LastEditTime: 2025-02-22 10:15:35
 * @FilePath: \koi-ui\src\api\system\user\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// 导入二次封装axios
import koi from "@/utils/axios.ts";
// 引入接口类型
import type { AdduserData } from "./type.ts";

// 统一管理接口
enum API {
  gl_role = "/role",
  gl_user = "/user",
}

// 获取所有用户
export const getAllUser = (params: any) => {
  return koi.get(API.gl_user + "/list", params);
};

// 获取所有角色
export const getAllRole = (params: any) => {
  return koi.get(API.gl_role + '/list', params);
};

// 删除用户
export const deleteUser = (userId: any) => {
  return koi.delete(API.gl_user + '/' + userId);
};

// 修改指定用户密码
export const updateUserPassword = (userId: any, data: any) => {
  return koi.put(API.gl_user + '/password/' + userId,
    {
      password: data.password
    }
  );
};

// 添加用户
export const addUser = (data: AdduserData) => {
  return koi.post(API.gl_user, data);
};
